package com.zxc.oj.ojcodesandbox;


import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.dfa.FoundWord;
import cn.hutool.dfa.WordTree;
import com.zxc.oj.ojcodesandbox.model.ExecuteCodeRequest;
import com.zxc.oj.ojcodesandbox.model.ExecuteCodeResponse;
import com.zxc.oj.ojcodesandbox.model.ExecuteMessage;
import com.zxc.oj.ojcodesandbox.model.JudgeInfo;
import com.zxc.oj.ojcodesandbox.utils.ProcessUtils;
import org.springframework.stereotype.Component;

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*;
@Component
public class JavaNativeCodeSandbox extends JavaCodeSandboxTemple {


    public static void main(String[] args) {
        JavaNativeCodeSandbox sandbox = new JavaNativeCodeSandbox();
        ExecuteCodeRequest request = new ExecuteCodeRequest();
        request.setInputList(Arrays.asList("1 2", "3 4"));
        String code = ResourceUtil.readStr("./testCode/simpleComputeArge/Main.java", StandardCharsets.UTF_8);
        request.setCode(code);
        request.setLanguage("java");
        ExecuteCodeResponse executed = sandbox.executeCode(request);
    }

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest request) {
        return super.executeCode(request);
    }

    @Override
    public File saveCodeToFile(String code) {
        return super.saveCodeToFile(code);
    }

    @Override
    public ExecuteMessage compileFile(File userCodeFile) {
        return super.compileFile(userCodeFile);
    }

    @Override
    public List<ExecuteMessage> run(File userCodeFile, List<String> inputList) {
        return super.run(userCodeFile, inputList);
    }

    @Override
    public ExecuteCodeResponse getOutputResponse(List<ExecuteMessage> executeMessageList) {
        return super.getOutputResponse(executeMessageList);
    }

    @Override
    public boolean delFile(File userCodeFile) {
        return super.delFile(userCodeFile);
    }

    @Override
    public ExecuteCodeResponse getErrorResponse(Throwable e) {
        return super.getErrorResponse(e);
    }
}
